
import { ICapability } from "@/components/capability";
import { server } from "@/views/Development/server";
import { message } from "antd";
import React from "react";
import { useSearchParams } from "react-router-dom";
import { v4 as uuidv4 } from 'uuid';

/** 源码 */
export function useViewCodeCapability(record): ICapability {

    const [searchParams] = useSearchParams();

    const id = searchParams.get('id');

    const onStart = React.useCallback(() => {
        server('/dev/capability/see?mid=' + id + '&id=' + record.id)
        message.success('请在终端查看源码位置')
    }, [record, id])

    return {
        id: uuidv4(),
        title: '定位源码',
        onStart,
    }
}